<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>采集器</title>
    <!--Layer -->




    <!-- Bootstrap Core CSS -->
    <link href="http://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- jQuery -->
    <script src="http://cdn.jsdelivr.net/npm/jquery@2.1.4/dist/jquery.min.js"></script>
    <script src="http://real.hffd.gov.cn/Content/js/jquery-1.8.2.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="http://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>


</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <h3>
                这是一个采集系统.
            </h3>
            <p>
                <em>采集系统</em> 是用于采集网上数据为目的的系统，本页面用于手动采集房源信息。
            </p>
            <div class="row clearfix">

                <div class="col-md-6 column">
                    <h3 class="text-info text-left">
                        采集
                    </h3>
                    <div class="form-group">
                        <label for="id">输入楼盘Id</label><input required  type="text" class="form-control" name="id" value="" id="id" />
                    </div>
                    <a onclick="reurl(this)"    class="btn btn-primary btn-lg btn-block active">立即采集</a>
                </div>
            </div>
            <input type="hidden" value="{$iptstamp}" id="iptstamp">
        </div>
    </div>
</div>
<script>

    $('#id').on('mouseout', function () {
        $('.btn').attr('id',$('#id').val());
    })



    function SetObjNum(n){
        var a="";
        for(var i=0;i<n;i++)
            a+=Math.floor(Math.random()*10);
        return a
    }

    function nscaler(a){
        var  b="";
        $.each(a,function(i,e){
            switch(e){
                case"0":b+="0";break;
                case"1":b+="2";break;
                case"2":b+="5";break;
                case"3":b+="8";break;
                case"4":b+="6";break;
                case"5":b+="1";break;
                case"6":b+="3";break;
                case"7":b+="4";break;
                case"8":b+="9";break;
                case"9":b+="7";break;
            }
        });
        return b
    }

    function recode(a)
    {
        var n	=	nscaler(a);
        var c	=	SetObjNum(a.length);
        var d	=	SetObjNum(a.length);
        n	=	parseInt(n)+	parseInt(d);
        var b	=	$("#iptstamp").val();
        b	=	nscaler(b.toString());
        return c+"-"+n+"-"+d+"-"+b
    }

    function reurl(a){
        var url = "/item/"+recode(a.id);
        $.post('/house/building_info/collect',{'url':url,'build_id':a.id},function (e) {
            if(e == 1){
                layer.alert('采集完成');
            }
        })
    };

</script>
</body>
</html>
</html>